import type { PageParam, PageResult } from '@vben/request';
import type { Dayjs } from 'dayjs';

import { requestClient } from '#/api/request';
export namespace PerFamilyEmploymentApi {
  /** 从业情况信息 */
  export interface FamilyEmployment {
    id: number; // 主键ID
    employeeId?: number; // 人员ID，对应 per_employee_id
    relation: string; // 与本人关系（称谓）
    systemPersonId: number; // 系统人员ID，对应system_person.id
    familyName: string; // 姓名
    cardType: string; // 证件类型
    familyIdcard: string; // 证件号码
    employerName: string; // 单位名称
    employerType: string; // 单位性质
    positionName: string; // 职务
    isSeniorPosition: number; // 是否担任高级职务（1：是，0：否）
    isLiveTogether: number; // 是否共同生活（1：是，0：否）
    isEmployed: number; // 是否在职（1：是，0：否）
    status: number; // 是否有效（1：有效，0：无效）
    remarks: string; // 备注
  }
}

/** 查询从业情况分页 */
export function getFamilyEmploymentPage(
  data: PageParam,
  desensitize: boolean,
  encrypt: boolean,
) {
  return requestClient.post<
    PageResult<PerFamilyEmploymentApi.FamilyEmployment>
  >('/per/family-employment/page', data, { desensitize, encrypt });
}

/** 查询从业情况详情 */
export function getFamilyEmployment(id: number) {
  return requestClient.get<PerFamilyEmploymentApi.FamilyEmployment>(
    `/per/family-employment/get?id=${id}`,
  );
}

/** 新增从业情况 */
export function createFamilyEmployment(
  data: PerFamilyEmploymentApi.FamilyEmployment,
) {
  return requestClient.post('/per/family-employment/create', data);
}

/** 修改从业情况 */
export function updateFamilyEmployment(
  data: PerFamilyEmploymentApi.FamilyEmployment,
) {
  return requestClient.put('/per/family-employment/update', data);
}

/** 删除从业情况 */
export function deleteFamilyEmployment(id: number) {
  return requestClient.delete(`/per/family-employment/delete?id=${id}`);
}

/** 批量删除从业情况 */
export function deleteFamilyEmploymentList(ids: number[]) {
  return requestClient.delete(
    `/per/family-employment/delete-list?ids=${ids.join(',')}`,
  );
}

/** 导出从业情况 */
export function exportFamilyEmployment(params: any) {
  return requestClient.download('/per/family-employment/export-excel', {
    params,
  });
}
